const Main_Option = {
  headerAlign: "center",
  align: "center",
  border: true,
  index: true,
  menuWidth: 150,
  // editBtn: false,
  // delBtn: false,
  editBtnIcon: ' ',
  delBtnIcon: ' ',
  // dialogMenuPosition: 'center',
  // defaultExpandAll:true,
  column: [
    {
      label: "活动名称",
      prop: "title",
      search: true,
      overHidden: true, // 是否隐藏
      rules: [{
        required: true,
        message: "请输入活动名称",
        trigger: "blur"
      }],
    },
    {
      label: "活动类型",
      prop: "type",
      type: 'select',
      search: true,
      dicData: [
        {
          label: '热门推荐',
          value: 1,
        },
        {
          label: '限时精选',
          value: 0,
        }
      ],
      rules: [{
        required: true,
        message: "请选择类型",
        trigger: "blur"
      }],
    },
    {
      label: "活动折扣",
      prop: "discount",
      rules: [{
        required: true,
        message: "请输入折扣如0.9",
        trigger: "blur"
      }],
    },
    {
      label: "活动排序",
      prop: "sort",
      // search: true,
      rules: [{
        required: true,
        message: "请输入活动排序",
        trigger: "blur"
      }],

    },
    {
      label: "新建时间",
      prop: "createdAt",
      display: false,
    },
    {
      label: "最后更新时间",
      prop: "updatedAt",
      display: false,
    },
  ]
}

const Main_Data = []


const Products_Option = {
  headerAlign: "center",
  align: "center",
  border: true,
  index: true,
  // selection: true,
  // reserveSelection: true,
  menuWidth: 150,
  addBtn: false, //新增
  editBtn: false,
  // delBtn: false,
  editBtnIcon: ' ',
  delBtnIcon: ' ',
  // dialogMenuPosition: 'center',
  // defaultExpandAll:true,
  column: [
    {
      label: "商品名称",
      prop: "title",
      search: true, // 开启搜索
      rules: [
        {
          required: true,
          message: "请输入商品名称",
          trigger: "blur",
        },
      ],
    },
    {
      label: "商品图",
      prop: "defaultImg",
      align: "center",
      slot: true, // 是否开启表格插槽
      // search: true, // 开启搜索
    },
    {
      label: "商品详情",
      prop: "decs",
      type: "textarea",
      overHidden: true, // 是否隐藏
      span: 24,
      // search: true,
    },
    {
      label: "原价格/￥",
      prop: "price",
      rules: [
        {
          required: true,
          trigger: ["change", "blur"],
        },
      ],
    },
  ]
}

const Products_Data = []

const SelectProducts_Option = (selected = [], IdMap = []) => {
  return {
    headerAlign: "center",
    align: "center",
    border: false,
    index: true,
    menu: false,
    menuWidth: 90,
    header: true,
    addBtn: false,
    editBtn: false,
    delBtn: false,
    selection: true,
    reserveSelection: true,
    selectable: (row, index) => {
      // false： 禁选; true: 可选
      let flag = true;
      // if (selected && selected.indexOf(row.pids) >= 0 && row.pids !== 2) flag = false;
      // if (IdMap && IdMap.indexOf(row.id) >= 0) flag = true;
      // console.log('flag: ', IdMap, flag);
      return flag;
    },
    searchMenuSpan: 8,
    // dialogMenuPosition: 'center',
    // defaultExpandAll:true,
    column: [
      {
        label: "商品名称",
        prop: "title",
        search: true,
        overHidden: true,
      },
      {
        label: "商品图",
        prop: "defaultImg",
        align: "center",
        slot: true, // 是否开启表格插槽
        overHidden: true,
      },
      {
        label: "商品详情",
        prop: "decs",
        type: "textarea",
        overHidden: true, // 是否隐藏
        span: 24,
      },
      {
        label: "原价格/￥",
        prop: "price",
        rules: [
          {
            required: true,
            trigger: ["change", "blur"],
          },
        ],
      },
      {
        label: "新建时间",
        prop: "createdAt",
        display: false,
        minWidth: 100,
      },
      {
        label: "最后更新时间",
        prop: "updatedAt",
        display: false,
        minWidth: 100,
      },
    ]
  }
}


const SelectProducts_Data = []

export {
  Main_Option,
  Main_Data,
  Products_Option,
  Products_Data,
  SelectProducts_Option,
  SelectProducts_Data,
}